package edu.towson.cosc603.coffeemaker;

import static org.junit.Assert.*;

import org.junit.Before;
import org.junit.Test;

public class InventoryTest {
	private CoffeeMaker cm;
	private Inventory i;
	private Recipe r1;
	
	@Before
	public void setUp() {
		cm = new CoffeeMaker();
		i = cm.checkInventory();
		i.setChocolate(100);
		i.setCoffee(100);
		i.setMilk(100);
		i.setSugar(100);
	}
	@Test
	public void testGetChocolatePositive() {
		i.setChocolate(1);
		assertEquals(i.getChocolate(), 1,1);
	}

	@Test
	public void testGetChocolateNegative() {
		i.setChocolate(-1);
		assertEquals(i.getChocolate(), 0,1);
	}
	
	@Test
	public void testGetChocolateZero() {
		i.setChocolate(0);
		assertEquals(i.getChocolate(), 0,1);
	}
	
	@Test
	public void testSetChocolatePositive() {
		i.setChocolate(1);
		assertEquals(i.getChocolate(), 1,1);
	}
	
	@Test
	public void testSetChocolateZero() {
		i.setChocolate(0);
		assertEquals(i.getChocolate(), 0,1);
	}
	
	@Test
	public void testSetChocolateNegative() {
		i.setChocolate(-1);
		assertEquals(i.getChocolate(), 0,1);
	}
	
	@Test
	public void testGetCoffeePositive() {
		i.setCoffee(1);
		assertEquals(i.getCoffee(), 1,1);
	}

	@Test
	public void testGetCoffeeZero() {
		i.setCoffee(0);
		assertEquals(i.getCoffee(), 0,1);
	}
	
	@Test
	public void testSetCoffeeNegative() {
		i.setCoffee(-1);
		assertEquals(i.getCoffee(), 0,1);
	}
	
	@Test
	public void testSetCoffeePositive() {
		i.setCoffee(1);
		assertEquals(i.getCoffee(), 1,1);
	}

	@Test
	public void testSetCoffeeZero() {
		i.setCoffee(0);
		assertEquals(i.getCoffee(), 0,1);
	}
	
	@Test
	public void testGetCoffeeNegative() {
		i.setCoffee(-1);
		assertEquals(i.getCoffee(), 0,1);
	}

	@Test
	public void testSetMilkPositive() {
		i.setMilk(1);
		assertEquals(i.getMilk(), 1,1);
	}

	@Test
	public void testSetMilkZero() {
		i.setMilk(0);
		assertEquals(i.getMilk(), 0,1);
	}
	
	@Test
	public void testSetMilkNegative() {
		i.setMilk(-1);
		assertEquals(i.getMilk(), 0,1);
	}
	

	@Test
	public void testGetMilkPositive() {
		i.setMilk(1);
		assertEquals(i.getMilk(), 1,1);
	}

	@Test
	public void testGetMilkZero() {
		i.setMilk(0);
		assertEquals(i.getMilk(), 0,1);
	}
	
	@Test
	public void testGetMilkNegative() {
		i.setMilk(-1);
		assertEquals(i.getMilk(), 0,1);
	}

	@Test
	public void testGetSugarPositive() {
		i.setSugar(1);
		assertEquals(i.getSugar(), 1,1);
	}

	@Test
	public void testGetSugarZero() {
		i.setSugar(0);
		assertEquals(i.getSugar(), 0,1);
	}
	
	@Test
	public void testGetSugarNegative() {
		i.setSugar(-1);
		assertEquals(i.getSugar(), 0,1);
	}
	
	@Test
	public void testSetSugarPositive() {
		i.setSugar(1);
		assertEquals(i.getSugar(), 1,1);
	}

	@Test
	public void testSetSugarZero() {
		i.setSugar(0);
		assertEquals(i.getSugar(), 0,1);
	}
	
	@Test
	public void testSetSugarNegative() {
		i.setSugar(-1);
		assertEquals(i.getSugar(), 0,1);
	}
	

	@Test
	public void testEnoughIngredientsCoffee() {
		i.setCoffee(1);
		
		r1 = new Recipe();
		r1.setName("Coffee");
		r1.setPrice(50);
		r1.setAmtCoffee(3);
		r1.setAmtMilk(1);
		r1.setAmtSugar(1);
		r1.setAmtChocolate(0);
	
		assertFalse(i.enoughIngredients(r1));
	}
	@Test
	public void testEnoughIngredientsMilk() {
		i.setMilk(1);
		
		r1 = new Recipe();
		r1.setName("Coffee");
		r1.setPrice(50);
		r1.setAmtCoffee(3);
		r1.setAmtMilk(2);
		r1.setAmtSugar(1);
		r1.setAmtChocolate(0);
	
		assertFalse(i.enoughIngredients(r1));
	}

	@Test
	public void testEnoughIngredientsSugar() {
		i.setSugar(0);
		
		r1 = new Recipe();
		r1.setName("Coffee");
		r1.setPrice(50);
		r1.setAmtCoffee(3);
		r1.setAmtMilk(2);
		r1.setAmtSugar(1);
		r1.setAmtChocolate(0);
	
		assertFalse(i.enoughIngredients(r1));
	}
	
	@Test
	public void testEnoughIngredientsChocolate() {
		i.setSugar(0);
		
		r1 = new Recipe();
		r1.setName("Coffee");
		r1.setPrice(50);
		r1.setAmtCoffee(3);
		r1.setAmtMilk(2);
		r1.setAmtSugar(1);
		r1.setAmtChocolate(1);
	
		assertFalse(i.enoughIngredients(r1));
	}
	
	@Test
	public void testEnoughIngredients() {
			
		r1 = new Recipe();
		r1.setName("Coffee");
		r1.setPrice(50);
		r1.setAmtCoffee(3);
		r1.setAmtMilk(2);
		r1.setAmtSugar(1);
		r1.setAmtChocolate(1);
	
		assertTrue(i.enoughIngredients(r1));
	}
}
